import { PROP_GS_TYPE } from "./GameGSDefine";
// import { EventKey } from "../common/Key";
import { EventKey } from "../common_for_guosheng/Key";

cc.Class({
    extends: cc.Component,

    properties: {
        labCount: cc.Label,
        sprIcon: cc.Sprite,
    },

    onLoad() {
        this.node.on('touchstart', () => {
			console.log("call daoju");
            F.GSPartner.sendEvent('道具', { '类型': this.type });
            F.OnEvent.fire(EventKey.EVENT_USE_PROP, { type: this.type, prop: this });
        }, this)
    },

    init(type, count) {
        this.labCount.string = count;
        this.type = type;
        let url = 'textures_for_guosheng/props/';
        if (type == PROP_GS_TYPE.HAMMER) {
            url += 'chuizismall';
        } else if (type == PROP_GS_TYPE.MAGIC_WAND) {
            url += 'magicsmall';
        } else if (type == PROP_GS_TYPE.WINDMILL) {
            url += 'colorSmall';
        }
        F.Common.setSpriteFrame(this.sprIcon, url);
    },


    // update (dt) {},
});
